#include "endgamedialog.h"
#include "ui_endgamedialog.h"

EndGameDialog::EndGameDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::EndGameDialog)
{
    ui->setupUi(this);
    pix.load(FALSE_OVER);
    this->initScene(); //初始化窗口
}

EndGameDialog::~EndGameDialog()
{
    delete ui;
}
void EndGameDialog::paintEvent(QPaintEvent *event){
    QPainter painter(this);
    painter.drawPixmap(150,20,pix);
}

//重玩
void EndGameDialog::on_again_clicked()
{
    emit endGame();
    this->hide(); //隐藏当前窗口
}

//返回
void EndGameDialog::on_back_clicked()
{
    emit endMusic();
    emit showMainMenu(); //发送信号显示主菜单
    emit closeMainWidget(); //发送信号关闭主窗口
    this->hide(); //隐藏当前窗口
}

//初始化窗口
void EndGameDialog::initScene(){
    setWindowTitle(GAME_NAME); //设置窗口名称
    setWindowIcon(QIcon(GAME_ICON_)); //设置窗口图标
    setFixedSize(600, 300);
    ui->again->setIconSize(QSize(200,100));
        ui->again->setIcon(QIcon(FALSE_AGAIN));
        ui->again->setStyleSheet("QPushButton{background-color:rgba(0,0,0,0);}");
        ui->back->setIconSize(QSize(250,100));
        ui->back->setIcon(QIcon(FALSE_MENU));
        ui->back->setStyleSheet("QPushButton{background-color:rgba(0,0,0,0);}");

}
